﻿using System;
using System.IO;

class CompareTwoTextFiles
{
    static void Main()
    {
        //Exercise 4.
        //Write a program that compares two text files line by line and prints the number of lines that are the same and 
        //the number of lines that are different. Assume the files have equal number of lines.

        string fileNameOne = @"C:\Users\Toni\Desktop\Test File.txt";
        StreamReader readerOne = new StreamReader(fileNameOne);
        string fileNameTwo = @"C:\Users\Toni\Desktop\Test File_2.txt";
        StreamReader readerTwo = new StreamReader(fileNameTwo);

        string lineFileOne = readerOne.ReadLine();
        string lineFileTwo = readerTwo.ReadLine();
        int lineNumber = 0;
        int equal = 0;
        while (lineFileOne != null)
        {
            lineNumber++;
            if (lineFileOne == lineFileTwo)
            {
                Console.WriteLine("Lines {0} are equal", lineNumber);
                equal++;
            }
            else
            {
                Console.WriteLine("Lines {0} are NOT equal", lineNumber);
            }
            lineFileOne = readerOne.ReadLine();
            lineFileTwo = readerTwo.ReadLine();
        }

        readerOne.Close();
        readerTwo.Close();
    }
}

